home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1993…ch: Other People's Memory / ADC Developer CD (1993-03) (''Other People's Memory'')_iso / Dev.CD Mar 93.iso / Development Platforms / LISP Related / LISP Goodies / McCartney-library 1.1 / CODE / file-utils / load-fasl.lisp < prev   
Encoding:
Text File  |  1992-09-02  |  2.0 KB  |  62 lines  |  [TEXT/CCL2]

  1. ;;; load-fasl.lisp
  2. ;;;
  3. ;;; Paul McCartney, Spring 1992
  4. ;;;
  5. ;;; Copyright © 1992 Paul McCartney.  All Rights Reserved.
  6. ;;; 
  7. ;;; Washington University Medical Informatics Training Program
  8. ;;;
  9. ;;; DESCRIPTION:
  10. ;;;
  11. ;;; The "load-fasl" function is intended to be a time-saving load function.
  12. ;;;
  13. ;;; USE:
  14. ;;;
  15. ;;; load-fasl
  16. ;;;
  17. ;;; Given the name of a .lisp file, it checks to see if there is a corresponding .fasl
  18. ;;; file.  If there isn't, or if the .lisp file is newer than the .fasl file, then the
  19. ;;; .lisp file is compiled.  The .fasl file is then loaded.
  20. ;;;
  21. ;;; The destination of the .fasl file can be either the directory where the .lisp file
  22. ;;; exists, or some other directory (useful if you like your fasl files in a 
  23. ;;; different directory than your source code).
  24. ;;;
  25. ;;; E.G.  (load "HD:code:foo.lisp")    ->  (load-fasl "HD:code:foo.lisp")
  26. ;;;                                 or ->  (load-fasl "HD:code:foo.lisp" "HD:code:FASL:")
  27. ;;;
  28. ;;; HISTORY:
  29. ;;;
  30. ;;; 6/12/90 Created.  - PM
  31. ;;; 4/5/92  Updated to MCL 2.0.  - PM
  32. ;;; 6/25/92 Added the optional fasl destination.  - PM
  33. ;;;
  34.  
  35. (in-package :ccl)
  36.  
  37. (eval-when (:compile-toplevel :load-toplevel :execute)
  38.   (export '(load-fasl) 
  39.           :ccl))
  40.  
  41.  
  42. (defun load-fasl (filename &optional fasl-directory
  43.                            &key (verbose *load-verbose*) (print *load-print*))
  44.   (let* ((default-pathname (compile-file-pathname filename))
  45.          (new-file (if fasl-directory
  46.                      (merge-pathnames (mac-file-namestring default-pathname) fasl-directory)
  47.                      default-pathname)) )
  48.     (cond ((modified-text-file filename new-file)
  49.            (format t "~%;Compiling: ~s" filename)
  50.            (compile-file filename :output-file new-file :load t))
  51.           (t (load new-file :verbose verbose :print print))) ))
  52.  
  53.  
  54. ;;; Check to see that the text file was modified after the fasl file
  55. ;;; Return t if the text file is newer, or no fasl file exists.
  56. ;;;
  57. (defun modified-text-file (file new-file)
  58.   (or (not (probe-file new-file))
  59.       (> (file-write-date file) (file-write-date new-file))))
  60.  
  61.  
  62. (provide :load-fasl)